<!doctype html>

<html>

<head>
<meta charset="UTF-8">
<title>管理员在线</title>
<script src="http://code.jquery.com/jquery-1.4.4.min.js"></script>
<style>

        body{
        
            background-color: #97CBFF;
           
           }



div{
    
    background:#009FCC;
   
    font-size:24px;
   
    padding:5px;
    
    color:white;

}
form{
   
      background: #97CBFF ;
  
      border:#357FC4 solid 1px;
    
      color:#575454;  
   
      width:400px;
    
      margin:20px auto;
    
      font-size:15px;

}

table{
    margin:10px auto;
}
a{
    text-decoration:none;
}

input[type="button"]{
    background:#228B22;
    color:white;
    font-

size:15px;
    font-weight:bold;
    width:120px;
    height:40px;
}
td:first-

child{
    text-align:right;
    padding:0 5px;
}
td:only-child{
    text-

align:center;
    font-size:12px;
}

span:before{
    content:"* ";
    color:red;
}

input[type="text"]:read-only{
    border:#888484 solid 2px;
    

background:#888484;
    font-weight:bold;   
}

input[type="text"]:hover{
    background:#EFD9AC;
}

</style>

<script>
         
          function getStudent(){
        	  var sid=$("#aaid").val();
        	  
        	 $.ajax({
        		 url: "/student",
        		 data:{"sno": sid},
        		 type: "post",
                
        	     success: function(abc){
        	    	 $.each(abc,function(i,fl){
        	    		 var id = fl.sno;//注意要与实体类中的名称相同
                         var name = fl.sname;
                         var sex = fl.ssex;
                         var age=fl.sage;
                         var dept = fl.sdept;
                         var major = fl.smajor;
                         var grade = fl.sgrade;
                         var sc_length = fl.school_length;
                         var address = fl.saddress;
                         var politics = fl.spol;
                         var nation = fl.snation;
                         var rp = fl.srp;
                         var move = fl.smove;
                  
                         var value = "<tr><td align='center'>"+id+"</td>";
                       
                          value +="<td align='center'>"+name+"</td> <td align='center'>"+sex+"</td> <td align='center'>"+age+"</td> <td align='center'>"+dept+"</td> <td align='center'>"+major+"</td> <td align='center'>"+grade+"</td> <td align='center'>"+sc_length+"</td> <td align='center'>"+address+"</td> <td align='center'>"+politics+"</td> <td align='center'>"+nation+"</td> <td align='center'>"+rp+"</td> <td align='center'>"+move+"</td><tr/>";
                
                         $("#tb").append(value);//写入到id为tb的html部分
  	                  });
        	     }
        	 })  
         }
      function updateStudent()
      {
    	  var sid=$("#aid").val();
    	  var name=$("#aname").val();
    	  var sex=$("#asex").val();
    	  var age=$("#aage").val();
    	  var dept=$("#adept").val();
    	  var major=$("#amajor").val();
    	  var grade=$("#agrade").val();
    	  var sschool_length=$("#aschool_length").val();
    	  var address=$("#aaddress").val();
    	  var spol=$("#apol").val();
    	  var nation=$("#anation").val();
    	  var srp=$("#arp").val();
    	  var move=$("#amove").val();
    	  
    		 
    		 $.ajax({
    	    	 url: "/updateStudent",
    			 data:{"sno": sid,"sname": name,"ssex": sex,"sage": age,"sdept": dept,"smajor": major,"sgrade": grade,"school_length": sschool_length,"saddress": address,"spol": spol,"snation": nation,"srp": srp,"smove": move},
    			 type:"post"
    	 })
    	    alert("修改成功!");
      }
         
       </script>


</head>

<body>

<form>

<div>修改学生信息</div>

<table>
 
   
<tr>
<td><span>学号</span></td>
<td><input type="text" name="sno" id="aid"/></td>
</tr>  

<tr>
<td><span>姓名</span></td>
<td><input type="text" name="sname" id="aname"/></td>
</tr>  

<tr>
<td><span>性别</span></td>
<td><input type="text" name="ssex" id="asex"/></td>
</tr>

<tr>
<td><span>年龄</span></td>
<td><input type="text" name="sage" id="aage"/></td>
</tr>  

<tr>
<td><span>系别</span></td>
<td><input type="text" name="sdept" id="adept"/></td>
</tr>  

<tr>
<td><span>专业</span></td>
<td><input type="text" name="smajor" id="amajor"/></td>
</tr>  

<tr>
<td><span>年级</span></td>
<td><input type="text" name="sgrade" id="agrade"/></td>
</tr>  

<tr>
<td><span>学制</span></td>
<td><input type="text" name="school_length" id="aschool_length"/></td>
</tr>  

<tr>
<td><span>地区</span></td>
<td><input type="text" name="saddress" id="aaddress"/></td>
</tr>  

<tr>
<td><span>政治面貌</span></td>
<td><input type="text" name="spol" id="apol"/></td>
</tr>  

<tr>
<td><span>民族</span></td>
<td><input type="text" name="snation" id="anation"/></td>
</tr>  

<tr>
<td><span>奖惩记录</span></td>
<td><input type="text" name="srp" id="arp"/></td>
</tr>  

<tr>
<td><span>休复转退学标记</span></td>
<td><input type="text" name="smove" id="amove"/></td>

<tr>
<td colspan="2"><input type="submit" name="submit" value="查看"  onclick="getStudent()"/></td>
</tr>
    
<tr>
<td colspan="2"><input type="submit" name="submit" value="确认修改"  onclick="updateStudent()"/></td>
</tr>

<tr>
<td colspan="2"><input type="button" name="submit" value="返回"   onclick="location.href='Administrator.html'"/></td>
</tr>

</table>

</form>
<div class="con_input">
<span>学               号：</span><input type="text" id="aaid" />
</div>
<table id="tb" width="80%" border="1" cellspacing="0" cellpadding="0" align="center">
		<tr>

			<th align="center">学号</th>
			<th align="center">姓名</th>
			<th align="center">性别</th>
			<th align="center">年龄</th>
			<th align="center">系别</th>
			<th align="center">专业</th>
			<th align="center">年级</th>
			<th align="center">学制</th>
			<th align="center">地区</th>
			<th align="center">政治面貌</th>
			<th align="center">民族</th>
			<th align="center">奖惩记录</th>
			<th align="center">休复转退标记</th>
			</tr>
	</table>
</body>  

</html>
